import java.util.Scanner;

public class Netease {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String[] resultSet = s.split("11");
		int result1 = 0,result2 = 0;
		if (resultSet.length>0){
			for (String temp:resultSet){
				int a = temp.length();
				if (a > result1)
					result1 = a;
			}
		}
		resultSet = s.split("00");
		if (resultSet.length>0){
			for (String temp:resultSet){
				int a = temp.length();
				if (a > result2)
					result2 = a;
			}
		}
		System.out.println(result1 > result2? result1:result2);
	}

}
